# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-alexa-top-sites
pkgname=('python2-alexa-top-sites' 'python-alexa-top-sites')
pkgver=5.98d6109
pkgrel=9
pkgdesc='Python library to fetch the top 1..N (where N < 1 million) sites from alexa.'
arch=('any')
url='https://github.com/philarkwright/Alexa-Top-Sites'
license=('BSD')
makedepends=('git' 'python2-setuptools' 'python-setuptools')
source=("$pkgbase::git+https://github.com/philarkwright/Alexa-Top-Sites.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgbase

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cp -a $pkgbase "$pkgbase-2"
}

build() {
  cd "$pkgbase-2"

  python2 setup.py build

  cd "$srcdir/$pkgbase"

  python setup.py build
}

package_python2-alexa-top-sites() {
  depends=('python2')

  cd "$pkgbase-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-alexa-top-sites() {
  depends=('python')

  cd $pkgbase

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

